import React, { useEffect, useState } from 'react'
import { View,Image } from '@tarojs/components'
import Taro from '@tarojs/taro'

import './index.scss'

export default function ExcitingScene() {
  const [list,setList] = useState([])
  useEffect(()=>{
    const {router} = Taro.getCurrentInstance()
    Taro.setNavigationBarTitle({
      title:`精彩现场`
    })
    Taro.showLoading({
      title:'加载中...'
    })
    Taro.$get(`/act/activities/scenePics/${router.params?.id}`,'','1').then(res=>{
      setList(res.content)
    })
  },[])
  function handlePreview(e){
    Taro.previewImage({
      urls:list,
      current:e
    })
  }
  return (
    <View className="exciting-scene">
      {list.length?
      <View className="scene-list">
        {list.map((item,index)=>{
          return <Image src={item} key={item} mode="aspectFill" onClick={()=>{handlePreview(index)}} className="list-item"></Image>
        })}
      </View>:
      <View className="var-empty">
        <View className='p'>暂无数据</View>
      </View>}
    </View>
  )
}
